package com.azhon.entry.utils;

import com.azhon.appupdate.utils.TextUtil;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.agp.components.Component;
import ohos.app.Context;
import org.junit.Test;

import static org.junit.Assert.*;

public class TextUtilTest {

    private final Context mContext = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();

    @Test
    public void isEmpty() {
        boolean state = TextUtil.isEmpty(new Component(mContext));
        assertTrue(state);
    }

    @Test
    public void testIsEmpty() {
        boolean state = TextUtil.isEmpty(new CharSequence() {
            @Override
            public int length() {
                return 0;
            }

            @Override
            public char charAt(int i) {
                return 0;
            }

            @Override
            public CharSequence subSequence(int i, int i1) {
                return null;
            }
        });
        assertFalse(state);
    }
}